package cn.edu.scau.cmi.chenyiqiu.objectAdapter;

import java.util.*;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class Controller {
	@FXML
	private TextArea infoArea;
	@FXML
	private TextField number;
	@FXML
	private TextField name;
	private List<StudentInfo> students=new ArrayList<StudentInfo>();
	private Target sorter=new SortAdapterOfObj();
	private StudentInfo s;
	public void sureinfo() {
		if(number.getText().equals("")||name.getText().equals(""))
			infoArea.setText("请输入正确的学生号和姓名！");
		else {	
			s=new StudentInfo();
			s.setnum(Integer.parseInt(number.getText()));
			s.setnam(name.getText());
			students.add(s);
			students=sorter.sortStu(students);
			infoArea.setText(students.toString());
			number.clear();
			name.clear();
		}
	}
	
}
